const Router = require('koa-router');

const moviesRouter = new Router({
	prefix:'/movies'
});


const pagesData = {
	1:{
		total_page:3,
		data:[{
			title:'Ifdsjkjfsd-1',
		},{
			title:'Fdsjkjfsd-1',

		},{
			title:'Dsjkjfsd-1',
		},{
			title:'Sjkjfsd=-1',
		},{
			title:'Jkjfsd-1',
		}]
	},
	2:{
		total_page:3,
		data:[{
			title:'Ifdsjkjfsd-2',
		},{
			title:'Fdsjkjfsd-2',

		},{
			title:'Dsjkjfsd-2',
		},{
			title:'Sjkjfsd=-2',
		},{
			title:'Jkjfsd-2',
		}]
	},
	3:{
		total_page:3,
		data:[{
			title:'Ifdsjkjfsd-3',
		},{
			title:'Fdsjkjfsd-3',

		},{
			title:'Dsjkjfsd-3',
		}]
	}
}

moviesRouter.get('/list', async (ctx,next)=>{
	console.log(ctx.request.query);
	const page = ctx.request.query.page || 1;
	ctx.body = pagesData[page];
})

module.exports = moviesRouter;

